home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMIGA-CD 2
/
Amiga-CD - Volume 2.iso
/
neue_programme
/
biz
/
datenbank
/
amigabase-stamps
/
arexx
/
callab.fw
< prev
next >
Wrap
Text File
|
1995-06-01
|
7KB
|
240 lines
/* AmigaBase <-> FinalWriter © 1995 Mads Lie Jensen
VER$ 1.0 28.02.1995
Use this script from inside FinalWriter
Purpose:
Used to retrieve some data from an AmigaBase Project, normally an
address, but it doesn't actually matter, which data you recieve.
The text retrieved is inserted into FinalWriter with the Font/Size/
Style set in this script. (You can change those if you want)
It's developed for inserting addresses into documents.
Usage:
You are asked for some text to pass to your AB-function. Here you
can specify a command, (See the 'ABserver'-script), or, as normally,
you enter some parameters to your AB-function. I normally gives
every address a number in my projects, so when I need an address,
I just type in the number, and my AB-function will return the complete
address. You could of course, also just use the name of the person,
who's address you need, or whatever you like.
You need to have the script 'ABserver.rexx' in your REXX:-drawer.
This script needs to get an empty string returned, if nothing was
found, matching the text you asked for. (If anything else is returned,
this will get inserted into your document.)
The script also supports commands!
(See the ABserver-script)
IMPORTANT!!
This script uses the default AB-function, defined in AB-server!!
*/
OPTIONS RESULTS
/* Get the filename of the Current Project of AmigaBase.
Used for the title of the Request-text window. This way you can always
see which project is currently in AB
*/
continue:
project = "REXX:ABserver.rexx"('%NAME')
IF project = '' THEN
project = '<Unnamed>'
ELSE
project = GetFName(project)
/*--------------------------------------------------------------------
Insert code to get the arguments to pass to your procedure here |
----------------------------------------------------------------------*/
ScreenToFront
RESULT = ''
RequestText project '"Get matching text"'
/* If nothing entered or Cancel is pressed */
IF RESULT = '' THEN
EXIT
ELSE
which = RESULT
/*----------------------------
End of code |
------------------------------*/
/*-----------------------------------------------------------------------------
You also have to put code in the SELECT...WHEN-loop, if you want to handle |
the return-values from the commands. If you don't do that, you cannot see |
if the command was succesfull or not. |
-----------------------------------------------------------------------------*/
/* Check if the user entered some of the commands. This is also checked
in the ABserver-script, but we also needs to know, if we want to display
the result of such a command.
*/
SELECT
WHEN RESULT = '%LOAD' THEN DO
CALL "Rexx:ABserver"('%LOAD')
/* Insert code to handle returned value here. 0 = No succes, 1 = Succes */
/* End */
SIGNAL continue
END
WHEN RESULT = '%NAME' THEN DO
RESULT = "Rexx:ABserver"('%NAME')
/* Insert code to handle returned value here. RESULT is empty if the
project has not yet been saved, else contains the file + path-name */
IF RESULT = '' THEN
ShowMessage 1 1 '"Current project of AmigaBase" "has not been given" "a name yet." "Ok" "" ""'
ELSE
ShowMessage 1 0 '"Current project of AmigaBase is:"' RESULT '"" "Ok" "" ""'
/* End */
SIGNAL continue
END
WHEN RESULT = '%SAVE' THEN DO
RESULT = "Rexx:ABserver"('%SAVE')
/* Insert code to handle returned value here. 0 = No succes, 1 = Succes */
IF RESULT = 0 THEN
ShowMessage 1 1 '"Save was NOT succesfull!" "" "" "Ok" "" ""'
/* End */
SIGNAL continue
END
WHEN RESULT = '%SAVEAS' THEN DO
RESULT = "Rexx:ABserver"('%SAVEAS')
/* Insert code to handle returned value here. 0 = No succes, 1 = Succes */
IF RESULT = 0 THEN
ShowMessage 1 1 '"Save was NOT succesfull!" "" "" "Ok" "" ""'
/* End */
SIGNAL continue
END
WHEN RESULT = '%QUIT' THEN DO
RESULT = "Rexx:ABserver"('%QUIT')
/* Insert code to handle returned value here. 0 = No succes,
1 = Success, -1 = Last project was quit, and AB closed down */
IF RESULT = 0 THEN
ShowMessage 1 1 '"The current project has NOT been closed." "" "" "Ok" "" ""'
ELSE DO
IF RESULT = -1 THEN DO
ShowMessage 1 1 '"AmigaBase has been closed." "" "" "Exit" "Continue" ""'
IF RESULT = 1 THEN
EXIT
END
END
/* End */
SIGNAL continue
END
WHEN RESULT = '%NEW' THEN DO
RESULT = "Rexx:ABserver"('%NEW')
/* Insert code to handle returned value here. 0 = No succes, 1 = Succes */
/* End */
SIGNAL continue
END
WHEN LEFT(RESULT,8) = '%PROJECT' THEN DO
RESULT = "Rexx:ABserver"(RESULT)
/* Insert code to handle returned value here. 0 = No succes, 1 = Succes */
IF RESULT = 0 THEN
ShowMessage 1 1 '"Project has NOT been changed" "" "" "Ok" "" ""'
/* End */
SIGNAL continue
END
OTHERWISE
END
/* Retrieve the text from Amigabase */
ret = "Rexx:ABserver"(RESULT)
/*-----------------------------------------------------------------------------
This is where you insert your commands. The returned text can be found
in the ret-variable.
-----------------------------------------------------------------------------*/
/* If anything is returned, then insert it */
IF LENGTH(ret)>0 THEN DO
/* All commands in here, are FinalWriters Arexx-commands.
If you don't like the way text is inserted, this is where you
change styles,fonts or whatever you don't like.
*/
ScreenToFront
WinToFront
/* Set the attributes for the text */
FontSize 8
Width 150
Spacing Variable
Leading 8
/* Insert the text */
Type ret
/* Set the attributes to the ones you want to use after the
inserted text
*/
FontSize 18
Width Normal
Spacing Single
Leading 14
END
ELSE
/* If an empty string was returned, which means not found */
ShowMessage 1 1 '"Cannot retrieve the text for"' which '"in current project" "Ok" "" ""'
/*-----------------------------------------------------------------------------
End of your commands
-----------------------------------------------------------------------------*/
EXIT
GetFName: PROCEDURE
/* Extraxt the filename from a complete path */
pos = LASTPOS('/',arg(1))
IF pos = 0 THEN
pos = LASTPOS(':',arg(1))
RETURN SUBSTR(arg(1),pos+1)